Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[When] Add support for flatten_all_tuples=False #1267

Closed
wants to merge 81 commits into from
Closed

Conversation

leonardt
Copy link
Collaborator

@leonardt leonardt commented May 4, 2023

Fixes #1253

@leonardt leonardt requested a review from rsetaluri May 4, 2023 16:38
@codecov-commenter
Copy link

codecov-commenter commented May 4, 2023

Codecov Report

Patch coverage: 95.60% and project coverage change: +0.01% 🎉

Comparison is base (4387b64) 85.94% compared to head (08434f5) 85.96%.

❗ Current head 08434f5 differs from pull request most recent head ecdea05. Consider uploading reports for the commit ecdea05 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1267      +/-   ##
==========================================
+ Coverage   85.94%   85.96%   +0.01%     
==========================================
  Files         169      169              
  Lines       17727    17765      +38     
==========================================
+ Hits        15236    15272      +36     
- Misses       2491     2493       +2     
Files Changed Coverage Δ
magma/backend/mlir/translation_unit.py 91.60% <50.00%> (-0.65%) ⬇️
magma/backend/mlir/hw.py 98.56% <83.33%> (-0.46%) ⬇️
magma/tuple.py 89.87% <86.66%> (-0.05%) ⬇️
magma/backend/mlir/compile_to_mlir_opts.py 100.00% <100.00%> (ø)
magma/backend/mlir/hardware_module.py 96.82% <100.00%> (+0.01%) ⬆️
magma/backend/mlir/magma_ops.py 100.00% <100.00%> (ø)
magma/backend/mlir/mlir_compiler.py 95.45% <100.00%> (ø)
magma/backend/mlir/when_utils.py 99.41% <100.00%> (+0.05%) ⬆️
magma/backend/mlir/xmr_utils.py 91.93% <100.00%> (+0.13%) ⬆️
magma/inline_verilog.py 98.11% <100.00%> (+0.89%) ⬆️
... and 4 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rsetaluri rsetaluri changed the title [when] add support for flatten_all_tuples=False [When] Add support for flatten_all_tuples=False May 4, 2023
Copy link
Collaborator Author

@leonardt leonardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rsetaluri I needed this change to get xmr working with unflattened tuples:

The assert is no longer valid because the paths are flattened but the module outputs aren't (we could compare to the flattened results length).

The path separator changes because the tuples values aren't flattened anymore (need to do a struct reference).

Does this make sense or am I misunderstanding what's going on? I will update the path separator logic to based on the flatten_all_tuples option
The path string should use . instead of _ since the fields aren't flattened.

@leonardt
Copy link
Collaborator Author

^ this comment is in reference to c6d802d

@leonardt
Copy link
Collaborator Author

Updated inline_verilog2 test to check both cases, skipped inline_verilog since we're deprecating that anyways

examples/riscv_mini/tests/test_unflattened_tuples.py Outdated Show resolved Hide resolved
magma/backend/mlir/mlir_compiler.py Show resolved Hide resolved
magma/backend/mlir/translation_unit.py Show resolved Hide resolved
magma/backend/mlir/when_utils.py Show resolved Hide resolved
magma/backend/mlir/xmr_utils.py Outdated Show resolved Hide resolved
magma/when.py Outdated Show resolved Hide resolved
magma/when.py Outdated Show resolved Hide resolved
magma/when.py Outdated Show resolved Hide resolved
tests/test_verilog/test_inline.py Show resolved Hide resolved
Comment on lines +14 to +15
# Change this to validate mlir->verilog compile doesn't error
_OUTPUT_TYPE = "mlir"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what the purpose of this is? we should either be testing mlir or mlir-verilog. if we need to test the latter then it should just be that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use it locally to ensure the compilation doesn't fail, this allows me to change the output for the entire file with a single variable, but we leave it on mlir for CI for speed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let's make it into a structured environment variable then

leonardt and others added 20 commits September 11, 2023 16:32
Fixes #1316

Ensures that recursive types check tuple key ordering
* [Bind2] Separate return statements

* [Bind2] Remove compile_guard argument

* [CompileGuard] Store compile guard info directly

* [CompileGuard] Expose active compile guards

* [Bind2] Stash active compile guards

Attaches active compile guard info's to bound instance metadata.

* [Bind2] Add tests for compile guarded bind2()

* [MLIR] Print attr_dict for sv.IfDefOp

* [MLIR] Add MlirOp.parent_op() function

* [MLIR] Add support for bind2 wrapped in compile guard

* Emit sv.IfDefOp around sv.BindOp
* Attach hw.OutputFileAttr for entire sub-tree of op's surrounding
  sv.BindOp (all enclosing sv.IfDefOp, and including sv.BindOp).
* Add generic MlirOpPass infrastructure

* [CompileGuard] Fix test

* [MLIR] Update golds

* [MLIR] Use := in MlirOp.parent_op()

* [MLIR] Make MlirOpPass callable interface

* [CompileGuard] Use Stack iterable interface

* [Bind2] Use getattr to get bound inst info
Fixes #1269

Adds a pass that splits when blocks with a cyclic dependency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MLIR] when support for flatten_all_tuples
3 participants